<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="s" uri="/struts-tags" %>

<c:import url="/view/admin/include/header/adminHeader.jsp"></c:import>
    <!-- 컨텐츠 부분 -->
	<div id="container">
    	<!-- 왼쪽 메뉴 부분 -->
    	<c:import url="/view/admin/include/left/adminLeft.jsp"></c:import>
        <!-- 왼쪽 메뉴 부분 -->
        <!-- 오른쪽 내용 부분 -->
        <dl>
        	<dd class="path">
        	홈 > 게시판 관리 > 
        		<span class="path_b">
        			소송진행 현황
        		</span>
        	</dd>
        </dl>
        <dl class="content">
            <dd class="summary">
			<ul class="tab qna_box">
	           <li class="off">기본정보</li>
		       <li class="off">제1심</li>
		       <li class="on">제2심</li>
		       <li class="off">대법원</li>
	        </ul>        
	           <dl>
        <span class="left f_orange">※ 진행 중이거나 완료된 소송기록을 확인하실 수 있습니다.</span>
           <p class="align_r">
        	<span class="f_red" style="right">*</span> 는 필수입력항목입니다.</p>
        </dl>
            	<form id="boardFrm" name="boardFrm" method="post" enctype="multipart/form-data">
            	<input type="hidden" name="writer" value="<s:property value="#session.name" />"> 
            	<input type="hidden" id="save_type" name="save_type" value="case" />
            	<input type="hidden" id="case_seq" name="case_seq" value="${boardBean.case_seq }" />
            	<input type="hidden" id="court_step" name="court_step" value="2" />
            	<table cellspacing="0" cellpadding="0" summary="" >
                	<caption></caption>
                    	 <colgroup>
                          <col width="15%;"/>
                          <col width="40%;"/>
                          <col width="15%;"/>
                          <col width="30%"/>
                         </colgroup>
                    <tbody>
                    	<tr>
                        	<th scope="row" class="table_txt_left"><span class="f_red">*</span>사건번호</th>
                            <td class="table_txt_left"><input id="case_no" name="case_no" type="text" style="width:200px;" maxlength="16"/></td>
                        	<th scope="row" class="table_txt_left"><span class="f_red">*</span>제(피)소일</th>
                            <td class="table_txt_left"><input id="case_date" class="datepicker" name="case_date" type="text" style="width:100px;" maxlength="8" readonly="readonly"/></td>
                        </tr>  
            			<tr>
	                        <th scope="row" class="table_txt_left"><span class="f_red">*</span>관할법원</th>
                            <td class="table_txt_left"><input id="court_name" name="court_name" type="text" style="width:200px;" maxlength="15"/>                         							    
                           	</td> 
    	                    <th scope="row" class="table_txt_left"><span class="f_red">*</span>재판부</th>
                            <td class="table_txt_left"><input id="court_dept" name="court_dept" type="text" style="width:200px;" maxlength="15"/>                         							    
                           	</td> 
                        </tr> 
                         <tr>
                      	    <th scope="row" class="table_txt_left">주심</th>
                            <td class="table_txt_left"><input id="head_referee" name="head_referee" type="text" style="width:200px;"/>                         							    
                           	</td> 
	                        <th scope="row" class="table_txt_left">종국결과</th>
                            <td class="table_txt_left"><input id="final_status" name="final_status" type="text" style="width:200px;"/>                         							    
                           	</td> 
                         </tr> 
                         <tr>
                         	<th scope="row" class="table_txt_left"><span class="f_red">*</span>원고대리인</th>
                            <td class="table_txt_left"><input id="plaintiff_agent" name="plaintiff_agent" type="text" style="width:200px;" maxlength="15" />                         							    
                           	</td> 
                         	<th scope="row" class="table_txt_left"><span class="f_red">*</span>피고대리인</th>
                            <td class="table_txt_left"><input id="defendant_agent" name="defendant_agent" type="text" style="width:200px;" maxlength="15"/>                         							    
                           	</td> 
                         </tr> 
                    </tbody>
                 </table>
                 </div>
                 </form>
          <dl>  	
            <dd class="btn_right">
            	<input type="button" id="btncansel" value="취소" class="input_btn_s b" />
            	<input type="button" id="btnSave" value="저장후 목록으로" class="input_btn_u b" />
            	<input type="button" id="btnNext" value="저장후 다음단계" class="input_btn_u b" />
            	<!-- <input type="button" id="btnList" value="목록" class="input_btn_s b" /> -->
            </dd>
         </dl>
          <p class="h_30"></p>
          <dl class="content">          
            <dd class="">
            	<table cellspacing="0" cellpadding="0" summary="" >
                	<caption></caption>
                    	 <colgroup>
							<col width="20%;"/>
							<col width="50%;"/>
							<col width="30%;"/>
							<%-- <col width="10%;"/> --%>
                         </colgroup>
                    <thead>
                    	<tr>
	                       	<th scope="col" class="table_th_bottom">년 월 일</th>
	                        <th scope="col" class="table_th_bottom">주요내용</th>
	                        <th scope="col" class="table_th_bottom">비고</th>
	                        <!-- <th scope="col" class="table_th_bottom">기능</th> -->
                        </tr>
                    </thead>
                    <tbody>
                    	<s:if test="%{1 > list.size()}">
                    	<tr>
                    		<td colspan="3">게시물이 없습니다.</td>
                    	<tr>
                    	</s:if>
                    	<s:iterator value="list" status="i" >
						<tr>
							<td style="text-align:left;">${log_date }</td>
								<td style="text-align:left;">${log_content }
								<c:if test="${!empty file1_name}">
								<a id="${case_seq}|${court_step}|${log_seq}|${attach1_seq}" class="fileDown" style="cursor:pointer"><img src="../../../images/common/icon_disk.png" width="13" height="13" title="${file1_name}" /></a>
								</c:if>
								<c:if test="${!empty file2_name}">
								<a id="${case_seq}|${court_step}|${log_seq}|${attach2_seq}" class="fileDown" style="cursor:pointer"><img src="../../../images/common/icon_disk.png" width="13" height="13" title="${file2_name}" /></a>
								</c:if>
								<c:if test="${!empty file3_name}">
								<a id="${case_seq}|${court_step}|${log_seq}|${attach3_seq}" class="fileDown" style="cursor:pointer"><img src="../../../images/common/icon_disk.png" width="13" height="13" title="${file3_name}" /></a>
								</c:if>
							</td>
		           			<td style="text-align:left;">${log_note }</td>	
							<!-- <td>
							수정|삭제
							</td> -->
						</tr>
						</s:iterator>
                    </tbody>
                 </table>
            </dd>
        </dl>
        <dl class="paginate">  	
            <dd class="btn_right">
            	<input type="button" id="/admin/caseRegpop2.hcom?case_seq=${boardBean.case_seq }&court_step=2" onClick="Pop_info5(this.id);" id="popWrite" value="+ 내용추가" class="input_btn b"/>
            	<!-- <input type="button" id="btnWrite" value="저장" class="input_btn_s b" />
            	<input type="button" id="btnList" value="목록" class="input_btn_s b" /> -->
            </dd>
        </dl>
        <!-- 오른쪽 내용 부분 -->
    <!-- 컨텐츠 부분 -->
<c:import url="/view/admin/include/footer/adminFooter.jsp"></c:import>
<script type="text/javascript" src="/jquery/datepicker.js"></script>
<script type="text/javascript" src="/jquery/jquery.watermarkinput.js" ></script>
<script type="text/javascript">
	$().ready(function(){		
			
		$("#btnList").click(function(){
			location.href="/admin/caseList.hcom?";
		});
		
		$("#btnNext").click(function(){
			if(validateCheck()){
				if(confirm("등록하시겠습니까?")){
			$("#boardFrm").attr('action','/admin/caseReg2.hcom?').submit();
				}
			}
		});
		
		/* $(document).keydown(function (e) {
		       if (e.keyCode == 8) {
		         alert('이전페이지로 돌아가실 수 없습니다.');
	           return false;
		        }
		    }); */
		    
		$("#btncansel").click(function(){
			location.href='/admin/casecansel.hcom?case_seq=${boardBean.case_seq}&court_step=${court_step}';
		});   
		    
		$("#btnSave").click(function(){
			if(validateCheck()){
				if(confirm("등록하시겠습니까?")){
			$("#boardFrm").attr('action','/admin/caseReg2s.hcom?').submit();
				}
			}
		});
		
	});

function validateCheck(){	
		
	if($("#case_no").val() == ''){
		alert('번호를 입력해주십시요');
		$("#case_no").focus();
		return false;
	}
	if($("#court_name").val() == ''){
		alert('내용을 입력해주십시요');
		$("#court_name").focus();
		return false;
	}
	if($("#court_dept").val() == ''){
		alert('내용을 입력해주십시요');
		$("#court_dept").focus();
		return false;
	}
	if($("#plaintiff_agent").val() == ''){
		alert('내용을 입력해주십시요');
		$("#plaintiff_agent").focus();
		return false;
	}
	if($("#defendant_agent").val() == ''){
		alert('내용을 입력해주십시요');
		$("#defendant_agent").focus();
		return false;
	}
			
	if($("#case_date").val() == ''){
		alert('날짜를 입력해주십시요');
		return false;
	}	
	return true;
} 
	
$(".fileDown").click(function(){
	var str = $(this).attr('id');
	var array = str.split('|');
	var case_seq = $.trim(array[0]);
	var court_step = $.trim(array[1]);
	var log_seq = $.trim(array[2]);
	var attach_seq = $.trim(array[3]);
	
	location.href='/admin/fileDownloadTh.hcom?case_seq='+case_seq+'&court_step='+court_step+'&log_seq='+log_seq+'&attach_seq='+attach_seq;
});
</script>
